package redis

import (
	"github.com/gomodule/redigo/redis"
	"time"
)

var (
	RedisClient *redis.Pool
	RedisHost string
	RedisDb int
)


func init()  {
	RedisHost = "127.0.0.1:6379"
	RedisDb = 0

	RedisClient = &redis.Pool{
		Dial : func() (redis.Conn, error) {
			c,err := redis.Dial("tcp", RedisHost)
			if err != nil {
				return nil,err
			}
			c.Do("SELECT", RedisDb)
			return c,nil
		},
		MaxIdle : 1,
		MaxActive : 10,
		IdleTimeout : 1000 * time.Millisecond,
	}
}

